from django.shortcuts import render
from home import models
from home import serializers
from rest_framework import viewsets
from rest_framework.views import APIView
from rest_framework.response import Response

# Create your views here.
class NavView(APIView):
    def get(self, request):
        pos=request.query_params.get("pos")
        navlist = models.NavModel.objects.filter(position=pos,isshow=True).order_by("order")
        ser = serializers.Sernav(navlist, many=True)
        return Response({"msg":"ok","data":ser.data})
class  BannerView(APIView):
    def get(self, request):
        bannerlist = models.BannerModel.objects.filter(isshow=True).order_by("order")
        ser = serializers.BannerSer(bannerlist, many=True)
        return Response({"msg":"ok","data":ser.data})
